package com.kalix.jyksh.system.dict.biz;

import com.kalix.framework.core.api.persistence.JsonStatus;
import com.kalix.framework.core.impl.system.BaseDictServiceImpl;
import com.kalix.jyksh.system.dict.api.biz.IKshDictBeanService;
import com.kalix.jyksh.system.dict.api.dao.IKshDictBeanDao;
import com.kalix.jyksh.system.dict.entities.KshDictBean;

public class KshDictBeanServiceImpl extends BaseDictServiceImpl<IKshDictBeanDao, KshDictBean>
        implements IKshDictBeanService {

    public KshDictBeanServiceImpl() {
        super();
    }

    @Override
    public JsonStatus saveEntity(KshDictBean entity) {
        Integer maxValue = dao.getFieldMaxValue("value","type='"+entity.getType()+"'");

        maxValue=maxValue+1;
        entity.setValue(maxValue);

        return super.saveEntity(entity);
    }

}
